<?php
require_once('../config.php');
require_once('database.php');
require_once('user.php');

$user = User::find_by_id($_GET['id']);
$fields = array();
$fields  = $_POST;	
if(isset($_POST['submit'])){
	
	$update_user = $user->update($user->id, $fields);
	
	if($update_user){
	
		header("Location: " . $config['base_url'] . "index.php?action=read");
		exit();

	}

}


?>

<form action="update.php?id=<?php echo $id; ?>" method="post">
	<input type="hidden" value="<?php $user->id;?>" />
	<label for="username">Username</label>
	<input type="text" name="username" value="<?php echo $user->username; ?>" />
	<label for="password">Password</label>
	<input type="password" name="password" value="<?php echo $user->password; ?>" />
	<input type="submit" value="Update" name="submit">
</form>